package com.bdqn.ssma.controller;




import com.bdqn.ssma.entity.Student;
import com.bdqn.ssma.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Controller
public class StudentController{
  
     StudentService studentService;
    @RequestMapping(value = "/info")
    public String findStudentById(Model model, Student student) {
        Map<String,Object> map=new HashMap<String,Object>();
        String name=student.getName();
        String classId=student.getClassId();
        map.put("name", "%"+name+"%");
        map.put("classId",  classId);
        List<Student> student1 = studentService.findStudent(map);
        model.addAttribute("student",student1);
        return "student";
    }
}

